From effd10be68d89702eb60070f8e1bb9b0eded0c07 Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Fri, 12 Jan 2007 14:51:27 +0000 Subject: [PATCH] Fix xencomm_copy_{from, to}_guest. It should not call paddr_to_maddr() with invalid address. Signed-off-by: Isaku Yamahata --- xen/common/xencomm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/common/xencomm.c b/xen/common/xencomm.c index f33c753934..8b7e502869 100644 --- a/xen/common/xencomm.c +++ b/xen/common/xencomm.c @@ -119,7 +119,7 @@ xencomm_copy_from_guest(void *to, const void *from, unsigned int n, chunksz -= chunk_skip; skip -= chunk_skip; - if (skip == 0) { + if (skip == 0 && chunksz > 0) { unsigned long src_maddr; unsigned long dest = (unsigned long)to + to_pos; unsigned int bytes = min(chunksz, n - to_pos); @@ -225,7 +225,7 @@ xencomm_copy_to_guest(void *to, const void *from, unsigned int n, chunksz -= chunk_skip; skip -= chunk_skip; - if (skip == 0) { + if (skip == 0 && chunksz > 0) { unsigned long dest_maddr; unsigned long source = (unsigned long)from + from_pos; unsigned int bytes = min(chunksz, n - from_pos); -- 2.30.2